<?php
namespace AuctionCore\Common;

/**
* 车主列表 单元测试
* @author       Eric Lee
*/
class ImageTest extends \PHPUnit_Framework_TestCase {

      public static  function testImage(){//by content
              $bucket = OSS_BUCKET;

              $file_path = '16321265409886_3030856_16.JPG';
              $object = 'car_base/left_front45/'.$file_path;
              $content = file_get_contents($file_path);

              $ret = Image::upload_file_by_content($bucket,$object,$content,'left_front45_');
              if(strpos($ret,'aliyuncs.com')){
                  echo "<img src='".$ret."'>";
                  $rs = true;
              }else{
                  $rs = false;
                  dump($ret);
              }
              self::assertTrue($rs);

      }
      public static  function testImage2(){//by file
             $bucket = OSS_BUCKET;

             $file_path = '16321265409886_3030856_16.JPG';
             $object = 'car_base/left_front45/'.$file_path;

             $ret = Image::upload_file_by_file($bucket,$object,$file_path,null,'left_front45_');
             if(strpos($ret,'aliyuncs.com')){
                  echo "<img src='".$ret."'>";
                  $rs = true;
             }else{
                  $rs = false;
                  dump($ret);
             }
             self::assertTrue($rs);

      }



}

?>